package com.cy.zs.hp.common.jsonResult;

import lombok.Data;

import java.io.Serializable;

/**
 * 借助此 对象封装控制层响应到客户端的数据
 */
@Data
public class JsonResult implements Serializable {
    private static final long serialVersionUID = -8722122492343039602L;
    /**响应状态码*/
    private Integer state=1;//1表示ok，0表示error
    /**响应状态码对应的具体信息*/
    private String message="ok";
    /**响应数据(一般是查询是获取到正确信息)*/
    private Object data;

    public JsonResult(){}

    public JsonResult(String message){
        this.message = message;
    }

    public JsonResult(Object data){
        this.data=data;
    }
    public JsonResult(Throwable e){
        this.state= 0;
        this.message = e.getMessage();
    }
}
